package com.mou.controller.admin;

import com.mou.result.Result;
import com.mou.service.HomeService;
import com.mou.vo.CategoryDistributionVO;
import com.mou.vo.KpiDataVO;
import com.mou.vo.RealtimeTradesDataVO;
import com.mou.vo.TradeTrendDataVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController("/adminHomeController")
@RequestMapping("/admin/home")
@Slf4j
public class HomeController {
    @Autowired
    private HomeService homeService;


    @GetMapping("/kpi")
    public Result<List<KpiDataVO>> kpi() {
        List<KpiDataVO> kpiDataVOList = homeService.kpi();
        return Result.success(kpiDataVOList);
    }

    @GetMapping("/tradeTrend")
    public Result<TradeTrendDataVO> tradeTrend() {
        TradeTrendDataVO tradeTrendData = homeService.tradeTrend();
        return Result.success(tradeTrendData);
    }

    @GetMapping("/categoryDistribution")
    public Result<List<CategoryDistributionVO>> categoryDistribution() {
        List<CategoryDistributionVO> categoryDistributionVOList = homeService.categoryDistribution();
        return Result.success(categoryDistributionVOList);
    }

    @GetMapping("/realtimeTrades")
    public Result<List<RealtimeTradesDataVO>> realtimeTrades() {
        List<RealtimeTradesDataVO> realtimeTradesDataVOList = homeService.realtimeTrades();
        return Result.success(realtimeTradesDataVOList);
    }


}
